#import <UIKit/UIKit.h>

#import "cocos2d.h"
#import "Button.h"

#define DOCK_SEPERATION 20.0f // How far apart objects are from each other in the dock

typedef enum  {
	kDockStateWaiting,
	kDockStateTrackingTouch
} DockState;

// Enumerated boundary crossings
typedef enum  {
	kNoBoundary,
	kRightBoundary,
	kLeftBoundary,
	kTopBoundary,
	kReturnToDock
} BoundaryState;

// An NSObject wrapper for the CGPoint struct 
@interface Pair : NSObject
{
	CGPoint point;
}

@property (nonatomic) CGPoint point;

+ (id) MakePair:(CGPoint)cgPoint;
- (id) initPair:(CGPoint)cgPoint;

@end

// A Dock object to mimic the functionality of the OS X dock. Can only be used with ButtonItem objects
@interface Dock : Layer 
{
	DockState state;
	ButtonItem *selectedItem;
	CGPoint startPoint; // absolute position
	NSMutableArray *itemsArray; // A helper array to hold buttonItems in the order of which they are in the dock (note that the dock ALSO holds them as children)
	NSMutableArray *positionsArray; // A helper array to hold relative positions of each dock index
	
	BoundaryState boundaryState;
	
	BOOL contracted; // True if the selected item is being dragged outside the dock and dock has already contracted items
}

+ (id) dockWithPosition:(CGPoint)pos;
- (id) initWithPosition:(CGPoint)pos;

- (int) CalculateInsertionIndex: (CGPoint)position;
- (void) Contract;
- (void) Expand: (int)insertIndex;
- (void) Update;

- (BoundaryState) BoundaryCheck: (CGPoint)position;

@end
